﻿@model cloudscribe.Core.Web.ViewModels.SiteUser.ForgotPasswordViewModel
@inject IStringLocalizer<CloudscribeCore> sr
@{
    ViewData["Title"] = sr["Forgot your password?"];
    ViewData["BodyClass"] = "account-section reset-password";
}
@if (!string.IsNullOrWhiteSpace(Model.RecaptchaSiteKey))
{
    <script src='https://www.google.com/recaptcha/api.js'></script>
}
@if (Model.UseInvisibleCaptcha)
{
    <script src="~/cr/js/cloudscribe-forgot-password-page.js"></script>
}

<h1>@ViewData["Title"]</h1>
<form id="forgot-password-form" asp-controller="Account" asp-action="ForgotPassword" method="post" role="form">
    <h4>@sr["Enter your email."]</h4>
    <hr />
    <div asp-validation-summary="All" class="text-danger"></div>
    <div class="mb-3">
        <label class="form-label" asp-for="Email">@sr["Email"]</label>
        <input asp-for="Email" class="form-control" />
        <span asp-validation-for="Email" class="invalid-feedback"></span>
    </div>
    @if (!string.IsNullOrWhiteSpace(Model.RecaptchaSiteKey) && !Model.UseInvisibleCaptcha)
    {
        <div class="mb-3">
            <div class="g-recaptcha" data-sitekey="@Model.RecaptchaSiteKey"></div>
            @Html.ValidationMessage("recaptchaerror", new { @class = "text-danger" })
        </div>
    }
    <div class="mb-3">
        @if (!string.IsNullOrWhiteSpace(Model.RecaptchaSiteKey) && Model.UseInvisibleCaptcha)
        {
            <button class="btn btn-primary g-recaptcha" data-sitekey="@Model.RecaptchaSiteKey" data-callback='onCaptchaSubmit' data-enabled-text='@sr["Submit"]' data-disabled-text='@sr["Working..."]'>@sr["Submit"]</button>
        }
        else
        {
            <button name="submit" type="submit" class="btn btn-primary">@sr["Submit"]</button>
        }
    </div>
</form>
@section Scripts {
    <script src="~/cr/js/jquery.validate.min.js"></script>
    <script src="~/cr/js/jquery.validate.unobtrusive.min.js"></script>
    <script src="~/cr/js/unobtrusive-validation-bs4.min.js"></script>
}
